Skip to content

Fix printer send + live telemetry; add hardware-in-the-loop tests - #143

Merged
t2vi merged 1 commit into
mainfrom
fix/printer-send-live-telemetry
Aug 30, 2026
Merged

Fix printer send + live telemetry; add hardware-in-the-loop tests#143
t2vi merged 1 commit into
mainfrom
fix/printer-send-live-telemetry

Conversation

@t2vi

@t2vi t2vi commented Aug 30, 2026

Copy link
Copy Markdown
Owner

Confirmed end-to-end against a real Bambu P2S.

send_print: force use_ams:false in the project_file payload. A re-sliced spoolbook .3mf carries no per-filament AMS metadata, so use_ams:true fails at HMS 07FF-8012 "Failed to get AMS mapping table" regardless of ams_mapping. With it false the printer feeds from the threaded filament and the print starts. ams_mapping/ams_mapping2 now always empty.

printer_mqtt:

  • max_packet_size 128KB -> 1MB. A P2S pushall full-status object overflowed 128KB, erroring the eventloop right after ConnAck -> the card flapped "Connected"/"Live" then back to "Not connected / No live job data".
  • connect / ConnAck / disconnect-with-error / subscribe-fail now log; the reconnect loop was previously silent.
  • publish_command uses a numeric sequence_id (submission_id()) + empty param, so the P2S actually acts on pause/resume/stop.
  • connect_and_subscribe_loop + publish_raw made pub for the new tests.

printer_telemetry: record_reading no longer .expect()s its queries. It runs on the MQTT eventloop task; a DB error there unwound the whole telemetry+control connection for the printer (pause/resume/stop dead until restart). Split into try_record_reading + a wrapper that logs and drops the one reading.

PrinterCard.svelte: drop the inline live feed from the status panel. An streaming the camera is a permanent client and Bambu firmware serves one at a time, so the card starved the printer's own toolhead-camera init mid-print. Camera is popup-only now.

reslicing: slice_via_service made pub.

tests/printer_live.rs (all #[ignore], local dev only, never CI):

  • live_connection_comes_up_and_stays_up
  • ftps_upload_roundtrips
  • send_a_print_then_cancel_before_it_extrudes
  • reslice_then_print_then_cancel (unsliced .3mf -> slicer-service -> print) Print tests are triple opt-in (SPOOLBOOK_TEST_ALLOW_REAL_PRINT=1) and cancel in PREPARE before any extrusion.

examples/stop_print.rs: standalone MQTT stop command, used as the manual kill switch while developing the print path.

Closes #141 #142

Confirmed end-to-end against a real Bambu P2S.

send_print: force use_ams:false in the project_file payload. A re-sliced
spoolbook .3mf carries no per-filament AMS metadata, so use_ams:true fails
at HMS 07FF-8012 "Failed to get AMS mapping table" regardless of
ams_mapping. With it false the printer feeds from the threaded filament and
the print starts. ams_mapping/ams_mapping2 now always empty.

printer_mqtt:
- max_packet_size 128KB -> 1MB. A P2S pushall full-status object overflowed
  128KB, erroring the eventloop right after ConnAck -> the card flapped
  "Connected"/"Live" then back to "Not connected / No live job data".
- connect / ConnAck / disconnect-with-error / subscribe-fail now log; the
  reconnect loop was previously silent.
- publish_command uses a numeric sequence_id (submission_id()) + empty
  param, so the P2S actually acts on pause/resume/stop.
- connect_and_subscribe_loop + publish_raw made pub for the new tests.

printer_telemetry: record_reading no longer .expect()s its queries. It runs
on the MQTT eventloop task; a DB error there unwound the whole
telemetry+control connection for the printer (pause/resume/stop dead until
restart). Split into try_record_reading + a wrapper that logs and drops the
one reading.

PrinterCard.svelte: drop the inline <img> live feed from the status panel.
An <img> streaming the camera is a permanent client and Bambu firmware
serves one at a time, so the card starved the printer's own toolhead-camera
init mid-print. Camera is popup-only now.

reslicing: slice_via_service made pub.

tests/printer_live.rs (all #[ignore], local dev only, never CI):
- live_connection_comes_up_and_stays_up
- ftps_upload_roundtrips
- send_a_print_then_cancel_before_it_extrudes
- reslice_then_print_then_cancel (unsliced .3mf -> slicer-service -> print)
Print tests are triple opt-in (SPOOLBOOK_TEST_ALLOW_REAL_PRINT=1) and cancel
in PREPARE before any extrusion.

examples/stop_print.rs: standalone MQTT stop command, used as the manual
kill switch while developing the print path.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XmMzHSCTn7fkYGn9rWNnPS
@t2vi
t2vi merged commit 50ea4fc into main Aug 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

spoolbook holds the printer's camera during prints → "toolhead camera initialisation failed"

1 participant